package com.infolab.aims.domain.asset;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;

@Entity
@NamedNativeQueries(
{
	@NamedNativeQuery(query="select rownum,ea.* from (select e.assetmodelid ,e.companycode,l.locationid,l.locationcode,l.locationname,assetmodelname," +
			"count(case when assetequipmentstatus='FAULT' then 1 end ) quantityFault," +
			"count(case when assetequipmentstatus='REPAIR' then 1 end ) quantityRepair," +
			"count(case when assetequipmentstatus='ACTIVE' then 1 end ) quantityActive," +
			"count(case when assetequipmentstatus='INACTIVE' then 1 end ) quantityNotActive" +
			",count(*) quantityAll from amtb_asset_equipment e,amtb_asset_model m," +
			"amtb_location l where m.assetmodelid=e.assetmodelid and " +
			"l.locationid=e.locationid and e.assetmodelid=:assetModelId group by e.assetmodelid, e.companycode,assetmodelname, " +
			"l.locationid,l.locationcode,locationname )ea", name = "AssetEquipmentBalance.getBalance",
			resultClass=AssetEquipmentBalance.class)
}
)
public class AssetEquipmentBalance implements Serializable {
	
	private String locationCode;
	
	private String companyCode;
	
	private String locationName;
	
	private String assetModelName;
	
	private Integer assetModelId;

	private Integer locationId;
	
	@Id
	private Integer rownum;
	
	private Integer quantityFault;
	
	private Integer quantityActive;
	
	private Integer quantityNotActive;
	
	private Integer quantityRepair;
	
	private Integer quantityAll;

	public String getLocationName() {
		return locationName;
	}

	public void setLocationName(String locationName) {
		this.locationName = locationName;
	}

	public String getAssetModelName() {
		return assetModelName;
	}

	public void setAssetModelName(String assetModelName) {
		this.assetModelName = assetModelName;
	}

	public Integer getAssetModelId() {
		return assetModelId;
	}

	public void setAssetModelId(Integer assetModelId) {
		this.assetModelId = assetModelId;
	}

	public Integer getQuantityFault() {
		return quantityFault;
	}

	public void setQuantityFault(Integer quantityFault) {
		this.quantityFault = quantityFault;
	}

	public Integer getQuantityAll() {
		return quantityAll;
	}

	public void setQuantityAll(Integer quantityAll) {
		this.quantityAll = quantityAll;
	}

	public String getLocationCode() {
		return locationCode;
	}

	public void setLocationCode(String locationCode) {
		this.locationCode = locationCode;
	}

	public Integer getLocationId() {
		return locationId;
	}

	public void setLocationId(Integer locationId) {
		this.locationId = locationId;
	}

	public Integer getQuantityActive() {
		return quantityActive;
	}

	public void setQuantityActive(Integer quantityActive) {
		this.quantityActive = quantityActive;
	}

	public Integer getQuantityNotActive() {
		return quantityNotActive;
	}

	public void setQuantityNotActive(Integer quantityNotActive) {
		this.quantityNotActive = quantityNotActive;
	}

	public Integer getQuantityRepair() {
		return quantityRepair;
	}

	public void setQuantityRepair(Integer quantityRepair) {
		this.quantityRepair = quantityRepair;
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public Integer getRownum() {
		return rownum;
	}

	public void setRownum(Integer rownum) {
		this.rownum = rownum;
	}
	
	
}
